﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PhotoGallery.Model;
using PhotoGallery.BLL;
public partial class message : System.Web.UI.Page
{
    protected string messagelist="";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user"] == null)
        {
            Response.Redirect("login.aspx");
        }
        else 
        {
            User u = (User)Session["user"];
            CommentAction ca = new CommentAction();
            PhotoAction pa = new PhotoAction();
            UserAction ua=new UserAction();
            List<Comment> list=ca.commentList(u.Uid);
            foreach (Comment com in list) 
            {
                if (com != null) 
                { 
                    if(com.State.Equals("0"))
                        messagelist += "<li class='unread'><a href=photo.aspx?pid="+com.Pid+"><div style='padding-top:10px;padding-bottom:20px;'>用户"+ua.getUserbyId(com.Uid).Nickname+"在图片<img width='50' src=" + pa.showPic(com.Pid).Pic + ">下评论了" + com.Content + "</div></a></li>";
                    else if(com.State.Equals("1"))
                        messagelist += "<li class='unread'><a href=photo.aspx?pid="+com.Pid+"><div style='padding-top:10px;padding-bottom:20px;'>用户" + ua.getUserbyId(com.Uid).Nickname + "收藏了您的图片<img width='50' src=" + pa.showPic(com.Pid).Pic + "></div></a></li>";
                }
            }
        }
    }
}